import numpy as np
import math
f = open(r"./data/coordinate.txt")
line = f.readline()
data_list = []
while line:
    num = list(map(float,line.split( )))
    # print(num)
    data_list.append(num)
    line = f.readline()
f.close()
data_array = np.array(data_list)
# print(data_array)

# print(data_array[1][1])

data = np.zeros((len(data_array),len(data_array)))

for i in range(len(data_array)):
    for j in range(len(data_array)):
        # print(data_array[j][0])
        # print(data_array[j][1])
        data[i][j] =  math.sqrt(((data_array[i][0]-data_array[j][0])**2)+((data_array[i][1]-data_array[j][1])**2))
np.savetxt('./data/data.csv',data,delimiter=',')